//
//  DDZdtjVCViewController.m
//  dingdang
//
//  Created by 阮 沧晖 on 15/7/19.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "DDZdtjVCViewController.h"
#import "DDNetWorkAPIClient.h"
#import "DDAnswerStat.h"
@interface DDZdtjVCViewController ()

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic,strong)NSArray *datas;
@end

@implementation DDZdtjVCViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self createUI];
    [self createData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)createUI
{
    self.view.backgroundColor = RGB(245, 245, 245);
    self.tableView.backgroundColor = RGB(245, 245, 245);
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBarHidden = YES;
    //自定义TAB BAR UI
//    [self addNavigatorTitle:NSLocalizedString(@"统计结果", nil) parent:self.view];
//    self.barViewControl.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_Background"]];
//    
//    [self AddLeftBtnAction:@"" normal:@"top_返回" selected:@"" action:^{
//        [self dismissViewControllerAnimated:YES completion:nil];
//    }];

    self.tableView.tableFooterView = [[UIView alloc]init];
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width,0.f)];
    
}


-(void)createData
{
    DDNetWorkAPIClient *network = [[DDNetWorkAPIClient alloc]init];
    [network mainAnswerStat:@{@"topicId":_topicId} completionBlock:^(BOOL isSuccess, NSString *message, NSString *status, id object) {
        if (isSuccess) {
            DDAnswerStat *stat = object;
            _datas = stat.data;
            [self.tableView reloadData];
        }
    }];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return _datas.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"UITableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    for (UIView *view in cell.contentView.subviews) {
        [view removeFromSuperview];
    }

    DDAnswerStat *stat = _datas[indexPath.section];
    cell.textLabel.text = @"1";
    
    return cell;
    
}


@end
